﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace TestApp
{
    public partial class MainPage : UserControl
    {
        public MainPage()
        {
            InitializeComponent();
            Scroll.Width = App.Current.Host.Content.ActualWidth;
            Scroll.Height = App.Current.Host.Content.ActualHeight - 80;
            Scroll.Margin = new Thickness(0, 80, 0, 0);

            btn_Position.Click += new RoutedEventHandler(btn_Position_Click);
            btn_Un.Click += new RoutedEventHandler(btn_Un_Click);

        }

        private void btn_Position_Click(object sender, RoutedEventArgs e)
        {
           

            //DPolygon p = new DPolygon();
             
            //master.Children.Add(p);
          //  master.MouseLeftButtonDown -= DRectangle.Play(master);
            DPolyline.Play(master);

            btn_Position.IsEnabled = false;
            btn_Un.IsEnabled = true;
        }

        private void btn_Un_Click(object sender, RoutedEventArgs e)
        {
            //DRectangle r = new DRectangle();
           
           // master.Children.Add(r);
            DRectangle.Play(master);
            DRectangle.PointDrawed += new EventHandler<DrawEventArgs>(DRectangle_DrawEnd);
            btn_Un.IsEnabled = false;
            btn_Position.IsEnabled = true;
        }

        private void DRectangle_DrawEnd(object sender, DrawEventArgs e)
        {
            var rg = sender as Rectangle;
        }

        
    }
}
